package com.changgou.test;

import io.jsonwebtoken.JwtBuilder;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;

import java.util.Date;

public class test03 {
    public static void main(String[] args) {
        long timeMillis = System.currentTimeMillis();
        Date date = new Date(timeMillis);

        JwtBuilder jwtBuilder = Jwts.builder()
                .setId("666")
                .setSubject("小白")
                .setIssuedAt(new Date())
                .setExpiration(date)
                .signWith(SignatureAlgorithm.HS256, "itcast");

        System.out.println(jwtBuilder.compact());
    }
}
